package cn.demo.app.a.controller;

import cn.demo.app.a.domain.User;
import cn.demo.app.a.service.UserService;
import cn.ifloat.brick.basic.common.toolkit.StringUtils;
import cn.ifloat.brick.logger.annotations.OperationLog;
import cn.ifloat.brick.logger.annotations.PerformanceLog;
import cn.ifloat.brick.logger.common.PerformanceUnit;
import cn.ifloat.brick.sprofile.common.init.config.SpringUtil;
import cn.ifloat.brick.sprofile.web.common.BasicController;
import cn.ifloat.brick.sprofile.web.init.config.WebEnvironmentConfig;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Controller
@RequestMapping("/layout")
public class AxiosLayoutController extends BasicController {
    @Autowired
    private UserService userService;

    @Autowired
    private WebEnvironmentConfig webEnvironmentConfig;

    private UserService copyUserService;

    @PostConstruct
    public void init() {
        copyUserService = SpringUtil.getBean(UserService.class);
        logger.info("init method success");
    }

    @RequestMapping()
    @PerformanceLog(unit = PerformanceUnit.MILLS)
    @OperationLog(logTlt = "操作日志测试 ${result} : ${now} ", application = "example", service = "user", condition = "")
    public String aaa(Model model) {
        List<User> list = userService.list();
        model.addAttribute("items", list);
        return "user/axios";
    }

}

